package edu.xust.utils;

import java.util.Random;

public class RoleUtil {
    /**
     * 采用随机数生成力量属性，其他属性在此基础上按比例进行计算
     * @param occupation
     * @return
     */
    public static int[] getProperty(String occupation) {
        int [] pro=new int[3];
        int strength = 0;//力量
        int physical = 0;//体力
        int intellige = 0;//智力
        int life = 0;//生命值
        int magic = 0;//魔法值
        int pAttack = 0;//物理攻击
        int mAttack = 0;//魔法攻击

        Random random = new Random();
        switch (occupation) {//.nextInt((max - min) + 1) + min;
            case "药神":
                strength = random.nextInt(2) + 9;//力量
                physical = random.nextInt(2) + 19;//体力
                intellige = random.nextInt(2) + 17;//智力
                break;
            case "战士":
                strength = random.nextInt(2) + 22;//力量
                physical = random.nextInt(2) + 15;//体力
                intellige = random.nextInt(2) + 5;//智力
                break;
            case "法师":
                strength = random.nextInt(2) + 5;//力量
                physical = random.nextInt(2) + 10;//体力
                intellige = random.nextInt(2) + 25;//智力
                break;
        }
        pro[0] = strength;//力量
        pro[1] = physical;//体力
        pro[2] = intellige;//智慧
        return pro;
    }

    public static int[] getAttach(int physical,int intellige,int strength){
        int attach[] = new int[4];
        int life = physical*20;//生命
        int magic = intellige*20;//魔法
        int pAttack = strength*2;//物攻
        int mAttack = intellige*2;//魔攻

        attach[0] = life;//生命
        attach[1] = magic;//魔法
        attach[2] = pAttack;//物攻
        attach[3] = mAttack;//魔攻
        return attach;
    }
}
